package com.qifei.xmlg_backend.utils;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class Md5PasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence rawPassword) {
        return Md5Utils.encrypt(rawPassword.toString()); // 加密方式你已经写好了
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        // 原始密码加密后，和数据库中的密码做比较
        return encode(rawPassword).equalsIgnoreCase(encodedPassword);
    }
}
